#ifndef FUNC_EXSPIFALSH_MUSIC_H
#define FUNC_EXSPIFALSH_MUSIC_H

#include "bsp_spiflash1.h"
#include "api_spiflash_ex.h"

typedef struct {
    u16 total_num;
    u16 cur_num;
    u8  pause;
    u8  rec_no_file;
	u8 mic_onoff;
	u8 vol_adjust;
	u8 need_adjust;
	u8 adjust_cnt;
	u32 pause_cnt;
	u16 time_offset;
    #if SPIFALSH_MUSIC_BREAK_MEMORY
    msc_breakpiont_t brkpt;//用于保存和恢复播放位置的结构体
    u16 save_time;//用于退出flash模式时保存的时间
    u16 save_num;//用于退出时保存当前播放歌曲的序号
    #endif // SPIFALSH_MUSIC_BREAK_MEMORY
	u16 timeout_cnt;
	u16 max_timeout_cnt;
	u8 song_index:4;
	u8 repeat_cnt:4;
	u8 song_int_flag:1;
	u8 song_continue_flag:1;
	u8 ticks_start:1;
	u8 power_on_tts:1;
	u8 QR_disable_tts:1;
	u32 delay_ticks;
} exspifalsh_msc_t;
typedef struct {
u16 start_time;
u16 end_time;
u32 frame_count;            //current frame count
u32 file_ptr;               //file ptr of current frame
}demo_play_time_info_t;
typedef struct {
	u16 time;	
	u8 light_mode;	
}song_time_play_t;
extern exspifalsh_msc_t exspi_msc;


void func_exspiflash_music_message(u16 msg);
void register_spi_read_function(int (* read_func)(void *buf, u32 addr, u32 len));
void func_exspifalsh_music_message(u16 msg);
void exspifalsh_music_switch_file(u8 direction);
void exspifalsh_rec_switch_file(u8 direction);
extern void mp3_res_play_kick(u32 addr, u32 len);
void non_volatile_memory(void);
void func_exspifalsh_sel(u8 sel_num);
void func_mic_onoff(u8 onoff);
void auto_stop_play_timer(void);
void func_check_timeout(void);

void func_switch_song(u8 key_index);
void func_switch_mic_onoff(u8 onoff);
void func_music_QRcode_disable(void);

#endif


